import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home',
      component: HomeView,
      children: [
        {
          path: '/home',
          name: 'home',
          component: () => import('../views/main.vue'),
        },
        {
          path: '/contactus',
          name: 'ConcatUS',
          component: () => import('../views/contact-us.vue'),
        },
        {
          path: '/production/:productionId',
          name: 'Production',
          component: () => import('../views/production.vue'),
        },
        {
          path: '/teamintroduction',
          name: 'TeamIntroduction',
          component: () => import('../views/team-introduction.vue'),
        },
        {
          path: '/productioninfo/:productionInfoId',
          name: 'ProductionInfo',
          component: () => import('../views/productioninfo.vue'),
        },
      ]
    },
    { path: '/:pathMatch(.*)',
      name:'NotFound',
      redirect:'/home',
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
    },
  ],
})

export default router
